const CracoAntDesignPlugin = require("craco-antd");
const CracoLessPlugin = require('craco-less');

module.exports = {
    plugins: [
        {
            plugin: CracoAntDesignPlugin,
        },
        {
            plugin: CracoLessPlugin,
            options: {
                modifyLessRule: function (lessRule, _context) {
                    lessRule.test = /\.(module)\.(less)$/;
                    lessRule.exclude = /node_modules/;
                    return lessRule;
                },
                cssLoaderOptions: {
                    modules: {
                        localIdentName: '[name]__[local]--[hash:base64:5]'
                    }
                },
                lessLoaderOptions: {
                    lessOptions: {
                        modifyVars: {},
                        javascriptEnabled: true,
                    },
                },
            },
        },
    ],
    devServer:{
        historyApiFallback: true,
        noInfo: false,
        // port:3100,
        proxy:{
            "/api/*": {
                target:"http://localhost:8080/",
                changeOrigin: true,
                secure: false,
                //pathRewrite: {'^/api' : ''}
            }
        }
    },
    babel: {
        plugins: [
            ["import", { "libraryName": "@moensun/antd-react-extension", "libraryDirectory": "lib","style":true}, "@moensun/antd-react-extension"]
        ]
    },
}
